package com.library.service;

import com.library.bean.Lend;
import com.library.dao.LendDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

@Service
public class LendService {

    @Autowired
    private LendDao lendDao;

    public boolean lendBook(long bookId, long readId) {
        return lendDao.lendBook(bookId,readId)>0&&lendDao.lendBooktwo(bookId)>0;
    }

    public boolean returnBook(long bookId, long readId) {
        return lendDao.returnBook(bookId,readId)>0&&lendDao.returnBooktwo(bookId)>0;
    }

    public ArrayList<Lend> lendlist() {
        return lendDao.lendlist();

    }

    public ArrayList<Lend> myLendList(long readerId) {
        return lendDao.myLendList(readerId);
    }
}
